
module.exports = app => {
  const { router, controller, middleware } = app;
  const { auth } = middleware;
  // 获取验证码
  router.get('/auth/captcha', controller.user.getCaptcha);
  // 登录
  router.post('/auth/login', controller.user.login);
  // 注销
  router.delete('/auth/logout', auth(), controller.user.logout);

  // 获取登录用户信息
  router.get('/users/me', auth(), controller.user.getUserInfo);
  // 根据id获取用户信息
  router.get('/users/:id/form', auth(), controller.user.userForm);
  // 分页
  router.get('/users/page', auth(), controller.user.list);

  // 添加
  router.post('/users', auth(), controller.user.save);

  // 修改
  router.put('/users/:id', auth(), controller.user.save);

  // 删除
  router.delete('/users/:ids', auth(), controller.user.remove);

  // 下载导入模板
  router.get('/users/template', auth(), controller.user.downloadTemplate);
  // 导入
  router.get('/users/_import', auth(), controller.user.import);
  // 导出
  router.post('/users/_export', auth(), controller.user.export);
};
